/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rubric;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;
import specifications.Directive;
import specifications.YamlObject;

/**
 *
 * @author Jason
 */
public class ScoredDirective implements YamlObject<ScoredDirective> {
    public static final Tag TAG = new Tag("!ScoredDirective");
    private Boolean fulfilled;
    private Directive directive;
    
    public ScoredDirective(){}
    public ScoredDirective(Directive d){
        this.directive = d;
    }
    
    @Override
    public void dump(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileWriter writer = new FileWriter(filename);
        writer.write(yaml.dumpAs(this, TAG, DumperOptions.FlowStyle.BLOCK));
        writer.close();
    }

    @Override
    public ScoredDirective load(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileReader reader = new FileReader(filename);
        ScoredDirective dir = yaml.loadAs(reader, ScoredDirective.class);
        reader.close();
        return dir;
    }

    /**
     * @return the fulfilled
     */
    public Boolean getFulfilled() {
        return fulfilled;
    }

    /**
     * @param fulfilled the fulfilled to set
     */
    public void setFulfilled(Boolean fulfilled) {
        this.fulfilled = fulfilled;
    }

    /**
     * @return the directive
     */
    public Directive getDirective() {
        return directive;
    }
   
    public void setDirective(Directive d){
        this.directive = d;
    }
}
